package com.example.muasic.fragment;


import android.media.Image;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.muasic.R;
import com.itheima.loopviewpager.LoopViewPager;
import com.itheima.loopviewpager.listener.OnItemClickListener;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;


/**
 * A simple {@link Fragment} subclass.
 */
public class RecommendFragment extends Fragment {
    private  View view;   //将本视图设置成全局变量，以便使用
    private LoopViewPager loopViewPager;
    private ImageView imageView;
    public RecommendFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        //展示滚动专辑
        view= inflater.inflate(R.layout.fragment_recommend, container, false);
        loopViewPager=view.findViewById(R.id.lvp_pager);
        loopViewPager.setImgData(this.imgListString());
        loopViewPager.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(View view, int i) {

            }
        });
        loopViewPager.start();
        //私人封fm、每日歌曲推荐、云音乐推荐
        String date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "";
        TextView dailyText = (TextView)view.findViewById(R.id.daily_text);
        dailyText.setText(date);


        //推荐歌单
        return view;
}
    private List<String> imgListString() {
        List<String> imageData = new ArrayList<>();
        imageData.add("http://p1.music.126.net/Kzl_ir78phY0oCnEHHxymQ==/109951163970011501.jpg");
        imageData.add("http://p1.music.126.net/shvl-fqPYI5EyTixyDzKhg==/109951163970403499.jpg");
        imageData.add("http://p1.music.126.net/HFmwIOO_2v7YilctlXd8AQ==/109951163970675274.jpg");
        imageData.add("http://p1.music.126.net/CBmkcdHyMQKWR_xwQVW3DQ==/109951163971751316.jpg");
        imageData.add("http://p1.music.126.net/IGd6dMSLBerK7PaeG4yT5w==/109951163970408501.jpg");
        imageData.add("http://p1.music.126.net/T3Vf8YTN0IoTV87bHSIqNg==/109951163970407195.jpg");
        imageData.add("http://p1.music.126.net/roAexvkJXPwnyMKGWLX2Fw==/109951163969279026.jpg");
        return imageData;
    }
}
